<?php

class SPDO extends PDO {

    private static $instance = null;

    public function __construct() {
        $config = Config::getInstance();

        parent::__construct('mysql:host=' . $config->get('dbHost') . ';dbname=' . $config->get('dbName'), $config->get('dbUser'), $config->get('dbPass'), array(
            PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8"));
    }

    public static function singleton() {
        if (self::$instance == null) {
            self::$instance = new self();
        }

        return self::$instance;
    }

}